package com.kaede.hayate.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConfigurationProperties(prefix = "application")
public class ApplicationProperties {

    /**
     * service缓存过期时间
     */
    private long serviceCacheValidityInSeconds = 180;
    /**
     * token过期时间
     */
    private long tokenValidityInSeconds = 3600;
    /**
     * token过期时间（记住我）
     */
    private long tokenValidityInSecondsForRememberMe = 12963000;// 24 * 3600 * 15

    /**
     * header中token的key
     */
    private String authorizationHeader = "Authorization";

    /**
     * header中token的前缀
     */
    private String tokenPrefix = "Bearer ";

    /**
     * token在缓存中的前缀
     */
    private String tokenSecretPrefix = "token:jwt:username:";

    /**
     * 不控制权限的url集合
     */
    private String[] ignoreUrls = {"/**/favicon.ico"};

    /**
     * 普通接口前缀
     */
    private String apiPrefix = "/api";

    private String tokenInvalidName = "tokenInvalid";

    public String getTokenInvalidName() {
        return tokenInvalidName;
    }

    public void setTokenInvalidName(String tokenInvalidName) {
        this.tokenInvalidName = tokenInvalidName;
    }

    public String getApiPrefix() {
        return apiPrefix;
    }

    public void setApiPrefix(String apiPrefix) {
        this.apiPrefix = apiPrefix;
    }

    public String[] getIgnoreUrls() {
        return ignoreUrls;
    }

    public void setIgnoreUrls(String[] ignoreUrls) {
        this.ignoreUrls = ignoreUrls;
    }

    public String getTokenPrefix() {
        return tokenPrefix;
    }

    public void setTokenPrefix(String tokenPrefix) {
        this.tokenPrefix = tokenPrefix;
    }

    public String getTokenSecretPrefix() {
        return tokenSecretPrefix;
    }

    public void setTokenSecretPrefix(String tokenSecretPrefix) {
        this.tokenSecretPrefix = tokenSecretPrefix;
    }

    public String getAuthorizationHeader() {
        return authorizationHeader;
    }

    public void setAuthorizationHeader(String authorizationHeader) {
        this.authorizationHeader = authorizationHeader;
    }

    public long getServiceCacheValidityInSeconds() {
        return serviceCacheValidityInSeconds;
    }

    public void setServiceCacheValidityInSeconds(long serviceCacheValidityInSeconds) {
        this.serviceCacheValidityInSeconds = serviceCacheValidityInSeconds;
    }

    public long getTokenValidityInSeconds() {
        return tokenValidityInSeconds;
    }

    public void setTokenValidityInSeconds(long tokenValidityInSeconds) {
        this.tokenValidityInSeconds = tokenValidityInSeconds;
    }

    public long getTokenValidityInSecondsForRememberMe() {
        return tokenValidityInSecondsForRememberMe;
    }

    public void setTokenValidityInSecondsForRememberMe(long tokenValidityInSecondsForRememberMe) {
        this.tokenValidityInSecondsForRememberMe = tokenValidityInSecondsForRememberMe;
    }
}
